package game;

import java.awt.*;
import java.awt.image.BufferedImage;

public class Background extends Sprite{

    private BufferedImage bg2;
    private int bg2x = 600;
    @Override
    public void init() {
        super.x = 0;
        super.y = 120;
        super.image = ImageManager.loadImage("src/Images/"+ GameData.Skin+"/bg1.png");
        super.width = image.getWidth();
        super.height = image.getHeight();
        this.bg2 = ImageManager.loadImage("src/Images/"+ GameData.Skin +"/bg2.png");
        super.speed = 4;
    }

    @Override
    public void move() {
        super.x = super.x - super.speed;
        if (x<=-600){
            x = 600;
        }
        this.bg2x = this.bg2x - super.speed;
        if (bg2x<=-600){
            bg2x = 600;
        }
    }

    @Override
    public void draw(Graphics g) {
        super.draw(g);
        g.drawImage(bg2,bg2x,y,image.getWidth(),image.getHeight(),null);
    }

    @Override
    public void destroy() {

    }
}
